from django.shortcuts import render
from django.http import HttpResponse
from .models import Article

def index(request):
    #在win系统上,mysql的排序规则(collation)无论是什么
    #都是大小写不敏感
    #在linux系统上,mysql的排序规则(collation)是utf8_bin
    #那么大小写敏感
    # article = Article.objects.filter(id__exact = 1)
    article = Article.objects.filter(title__exact = '钢铁')
    print(article.query) #  id=钢铁 title__exact
    print(article)
    article = Article.objects.filter(title__iexact='钢铁')
    print(article.query)  #打印sql语句   id like 钢铁  title__iexact
    print(article)
    return HttpResponse('success')
